Skip to content

feat: Add kernel language model service#586

Merged
grypez merged 15 commits into
mainfrom
grypez/kernel-language-model-service
Aug 12, 2025
Merged

feat: Add kernel language model service#586
grypez merged 15 commits into
mainfrom
grypez/kernel-language-model-service

Conversation

@grypez

@grypez grypez commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

Lays out a strategy for language model integration into the ocap-kernel.

Changes

  • New package: @ocap/kernel-language-model-service. Implementation-specific dependencies are isolated into distinct exports.

@ocap/kernel-language-model-service

  • Provides a streaming language model interface. There is a makeInstance method, which returns an object with a sample method. The name sample is chosen to align with the semantics of sample in the model context protocol1.
  • Provides a nodejs ollama client implementation, OllamaNodejsService.
  • Adds an e2e test which can be used to connect to and test integration with an ollama server running locally on the development workstation.

Note to Reviewers

An unused 'archetypes' abstraction was removed because it was out of scope. Good model selection for a task depends on both the details of the request and the execution context. The kernel-language-model-service package provides basic integrations against a uniform interface that nods to MCP and satisfies eventual-send.

Footnotes

  1. https://modelcontextprotocol.io/specification/2025-06-18/client/sampling

@socket-security

socket-security Bot commented Aug 7, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​unrs/​resolver-binding-android-arm-eabi@​1.11.11001003786100
Added@​unrs/​resolver-binding-android-arm64@​1.11.11001003786100
Updated@​unrs/​resolver-binding-darwin-arm64@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-darwin-x64@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-freebsd-x64@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-linux-arm-gnueabihf@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-linux-arm-musleabihf@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-linux-arm64-gnu@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-linux-arm64-musl@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-linux-ppc64-gnu@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-linux-riscv64-gnu@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-linux-riscv64-musl@​1.7.0 ⏵ 1.11.11001003790 -4100
Updated@​unrs/​resolver-binding-linux-s390x-gnu@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-linux-x64-gnu@​1.7.0 ⏵ 1.11.11001003791 -2100
Updated@​unrs/​resolver-binding-linux-x64-musl@​1.7.0 ⏵ 1.11.11001003791 -3100
Updated@​unrs/​resolver-binding-win32-arm64-msvc@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-win32-ia32-msvc@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-win32-x64-msvc@​1.7.0 ⏵ 1.11.11001003791 -4100
Updated@​unrs/​resolver-binding-wasm32-wasi@​1.7.0 ⏵ 1.11.1100 +110066 +191 -4100
Added@​typescript-eslint/​visitor-keys@​8.38.01001006897100
Added@​typescript-eslint/​parser@​8.38.01001006997100
Added@​typescript-eslint/​project-service@​8.38.01001006997100
Updated@​napi-rs/​wasm-runtime@​0.2.9 ⏵ 0.2.12100 +110072 +194100
Updated@​emnapi/​runtime@​1.4.3 ⏵ 1.4.5991007388100
Added@​typescript-eslint/​type-utils@​8.38.01001007497100
Added@​typescript-eslint/​types@​8.38.01001007497100
Updated@​emnapi/​core@​1.4.3 ⏵ 1.4.51001007588100
Added@​typescript-eslint/​scope-manager@​8.38.01001007697100
Added@​typescript-eslint/​typescript-estree@​8.38.0991007797100
Added@​typescript-eslint/​eslint-plugin@​8.38.0991007897100
Updated@​tybys/​wasm-util@​0.9.0 ⏵ 0.10.0100 +1100100 +180100
Addedignore@​7.0.510010010082100
See 5 more rows in the dashboard

View full report

@socket-security

socket-security Bot commented Aug 7, 2025

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring alerts on:

  • ollama@0.5.17
  • unrs-resolver@1.11.1

View full report

@grypez grypez force-pushed the grypez/kernel-language-model-service branch from 5c11916 to 31b004f Compare August 8, 2025 14:41
@grypez

grypez commented Aug 11, 2025

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore ollama@0.5.17

To be addressed by an endowment management solution.

@grypez

grypez commented Aug 11, 2025

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/prettier@3.6.2

This dev dependency is an acceptable risk.

@grypez

grypez commented Aug 11, 2025

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/unrs-resolver@1.11.1

The install script is disabled by lavamoat in the monorepo package.json.

@grypez grypez force-pushed the grypez/kernel-language-model-service branch 3 times, most recently from 46097da to 9aa4bb2 Compare August 11, 2025 15:09
@grypez grypez marked this pull request as ready for review August 11, 2025 16:45
@grypez grypez requested a review from a team as a code owner August 11, 2025 16:45
@grypez grypez force-pushed the grypez/kernel-language-model-service branch from e93bd66 to 2a0ef39 Compare August 12, 2025 12:09
cursor[bot]

This comment was marked as outdated.

@grypez grypez force-pushed the grypez/kernel-language-model-service branch from 2a0ef39 to a21cc75 Compare August 12, 2025 12:51
cursor[bot]

This comment was marked as outdated.

@grypez grypez force-pushed the grypez/kernel-language-model-service branch from a21cc75 to 65777e9 Compare August 12, 2025 13:18

@sirtimid sirtimid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one! A couple of things to change but the other nits

Comment thread packages/kernel-language-model-service/src/ollama/base.ts Outdated
Comment thread packages/kernel-language-model-service/package.json
Comment thread packages/kernel-language-model-service/src/ollama/base.ts Outdated
Comment thread packages/kernel-language-model-service/src/ollama/base.ts Outdated
Comment thread packages/kernel-language-model-service/src/ollama/base.ts Outdated
Comment thread packages/kernel-language-model-service/src/ollama/base.ts
Comment thread packages/kernel-language-model-service/src/ollama/base.ts Outdated
Comment thread packages/kernel-language-model-service/src/ollama/parse.ts Outdated
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@grypez grypez requested a review from sirtimid August 12, 2025 16:58
sirtimid
sirtimid previously approved these changes Aug 12, 2025
@grypez grypez changed the title feat: Add kernel language model service feat: Add language model service Aug 12, 2025
@grypez grypez force-pushed the grypez/kernel-language-model-service branch from 6668f20 to 01c2854 Compare August 12, 2025 17:52
@grypez grypez changed the title feat: Add language model service feat: Add kernel language model service Aug 12, 2025
@grypez grypez enabled auto-merge (squash) August 12, 2025 17:54

@sirtimid sirtimid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@grypez grypez merged commit a5c2f60 into main Aug 12, 2025
41 checks passed
@grypez grypez deleted the grypez/kernel-language-model-service branch August 12, 2025 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants